﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ScriptEditor.Commands
{
    class Command_ShowSprite : Command
    {
        public string name
        {
            get
            {
                return Value1;
            }
            set
            {
                Value1 = value;
            }
        }
        public float duration
        {
            get
            {
                return float.TryParse(Value2, out float result) ? result : 0.5f;
            }
            set
            {
                Value2 = value.ToString();
            }
        }
        public Vector3 position
        {
            get
            {
                return StringToVector3(Value3);
            }
            set
            {
                Value3 = Vector3ToString(value);
            }
        }
        public Vector2 scaleSize
        {
            get
            {
                return StringToVector2(Value4);
            }
            set
            {
                Value4 = Vector2ToString(value);
            }
        }
        public string matName
        {
            get
            {
                return Value5;
            }
            set
            {
                Value5 = value;
            }
        }
        public float visibility
        {
            get
            {
                return float.TryParse(Value6, out float result) ? result : 1;
            }
            set
            {
                Value6 = value.ToString();
            }
        }
        public Command_ShowSprite()
        {
            CommandType = COMMANDTYPE.ShowSprite;
            name = "请输入图片名";
            duration = 0.5f;
            position = new Vector3 { x = 0, y = 0, z = 0 };
            scaleSize = new Vector2 { x = 1, y = 1 };
            matName = "";
            visibility = 1;
            Wait = true;
        }
        public Command_ShowSprite(string Name, float Duration, Vector3 Position, Vector2 ScaleSize, string MatName, float Visibility, bool WaitForComplete)
        {
            CommandType = COMMANDTYPE.ShowSprite;
            name = Name;
            duration = Duration;
            position = Position;
            scaleSize = ScaleSize;
            matName = MatName;
            visibility = Visibility;
            Wait = WaitForComplete;
        }
        public override string ToString()
        {
            return CommandType.ToString() + ":\n" + "显示图片:" + name;
        }
    }
}
